﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using KeaoBase;

namespace KeaoMDS.Report
{
    public partial class CheLiangYunShuCiShu : BaseForm
    {
        public CheLiangYunShuCiShu()
        {
            InitializeComponent();
        }

        private void CheLiangYunShuCiShu_Load(object sender, EventArgs e)
        {
            grid_yunshucishu.AutoGenerateColumns = false;
            dateTimePicker1.Value = DateTime.Today;
            dateTimePicker2.Value = dateTimePicker1.Value.AddHours(23).AddMinutes(59).AddSeconds(59);
            BindInfo();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            BindInfo();
        }


        private void BindInfo()
        {
            string createCondition = KeaoUtils._DB.CreateAndCondition("maozhongshijian", DataValueCommonType.日期时间, dateTimePicker1.Value.ToString("yyyy-MM-dd HH:mm:ss"), dateTimePicker2.Value.ToString("yyyy-MM-dd HH:mm:ss"), SearchConditionType.between);
            string tableCols = string.Format("{0} as riqi,chepaihao,count(id) as cishu", KeaoUtils._DB.DateFormatFun("maozhongshijian"));
            string groupCols = string.Format("{0},chepaihao",KeaoUtils._DB.DateFormatFun("maozhongshijian"));
            DataTable Dt = KeaoUtils._DB.GetDataTableByCondition("tbl_chengzhong", tableCols, null, createCondition, groupCols, null);
            grid_yunshucishu.DataSource = Dt;
        }
    }
}
